package com.fjw.service.impl;

import com.fjw.mapper.MaterialMapper;
import com.fjw.pojo.Material;
import com.fjw.service.MaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MaterialServiceImpl implements MaterialService {

    @Autowired
    private MaterialMapper materialMapper;

    @Override
    public void add(Material material) {
        materialMapper.add(material);
    }

    @Override
    public Material findById(Integer id) {
        return materialMapper.findById(id);
    }

    @Override
    public List<Material> findByCategory(String category) {
        return materialMapper.findByCategory(category);
    }

    @Override
    public List<Material> findByAuthor(Integer author) {
        return materialMapper.findByAuthor(author);
    }

    @Override
    public void deleteById(Integer id) {
        materialMapper.deleteById(id);
    }

    @Override
    public void updateById(Material material) {
        materialMapper.updateById(material);
    }

    @Override
    public List<Material> getAll() {
        return  materialMapper.getAll();
    }
}
